package cn.test.my.excel.poi.convert;

import java.lang.reflect.Field;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

import cn.test.my.excel.poi.annotation.SetCellStyle;


/**
 * LocalDate 转换
 *
 * @author summit
 * @since 2021/6/6 20:11
 */
public class LocalDateConverter implements Converter<LocalDate> {

	@Override
	public Class<LocalDate> supportJavaTypeKey() {
		return LocalDate.class;
	}

	@Override
	public LocalDate convertToJavaData(Field filed, String rowData, SetCellStyle style)
			throws Exception {
		String pattern = style.datePattern();
		return LocalDate.parse(rowData, DateTimeFormatter.ofPattern(pattern));
	}
}
